package com.ftg.learn.chapter17;

import com.ftg.learn.chapter15.MyValue;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 * 老虎
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/3/27 下午3:40
 */
@Component
@Scope("prototype")
// tiger
//<bean id="abc" class="com.ftg.learn.chapter17.Tiger">
//</bean>
@Data
public class Tiger {

    public Tiger(){
        System.out.println("初始化");
    }


    @PostConstruct
    public void say1(){
        System.out.println("====>");
    }

    @PostConstruct
    public void say(){
        System.out.println("------->");
    }

//    @Value("张三")
    private String name;
    @Value("张三的歌")
    private String desc;

    /**
     * idea 表示  Autowired 不建议在字段上面使用
     */

    private IWolf brother;

    @Autowired(required = false)
    public void setBrother(IWolf brother) {
        this.brother = brother;
    }

    @Resource
    private IWolf brother1;

}
